/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ecom.beans.address;

import ecom.beans.customer.*;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;

/**
 *
 * @author Tian
 */

@NamedQuery(name = "findAllAddresses", query = "SELECT address FROM AddressEntity address")

@Entity
public class AddressEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    
    
    private int addressType;
    private int streetNum;
    private String streetName;
    private int buildingNum;
    private int floorNum;
    private int apartmentNum;
    private String zipcode;
    private String city;
    
    public AddressEntity() {
        
    }
    

    public AddressEntity(int addressType, int streetNum, String streetName, int buildingNum, int floorNum,
                         int apartmentNum, String zipcode, String city) {   
        this.setAddressType(addressType);
        this.setStreetNum(streetNum);
        this.setStreetName(streetName);
        this.setBuildingNum(buildingNum);
        this.setFloorNum(floorNum);
        this.setApartmentNum(apartmentNum);
        this.setZipcode(zipcode);
        this.setCity(city);
    }


     public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }

    public int getAddressType() {
        return this.addressType;
    }
    
    public void setAddressType(int addressType) {
        this.addressType = addressType;
    }
    
    public int getStreetNum() {
        return this.streetNum;
    }

    public void setStreetNum(int streetNum) {
        this.streetNum = streetNum;
    }

    public String getStreetName() {
        return this.streetName;
    }

    public void setStreetName(String streetName) {
        this.streetName = streetName;
    }

    public int getBuildingNum() {
        return this.buildingNum;
    }

    public void setBuildingNum(int buildingNum) {
        this.buildingNum = buildingNum;
    }

    public int getFloorNum() {
        return this.floorNum;
    }

    public void setFloorNum(int floorNum) {
        this.floorNum = floorNum;
    }

    public int getApartmentNum() {
        return this.apartmentNum;
    }

    public void setApartmentNum(int apartmentNum) {
        this.apartmentNum = apartmentNum;
    }

    public String getZipcode() {
        return this.zipcode;
    }

    public void setZipcode(String zipcode) {
        this.zipcode = zipcode;
    }

    public String getCity() {
        return this.city;
    }

    public void setCity(String city) {
        this.city = city;
    }
    /**************************************************/
    
    @Override
    public int hashCode() {
        int hash = 0;
        
        hash += (id != null ? id.hashCode() : 0);
       
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AddressEntity)) {
            return false;
        }
        AddressEntity other = (AddressEntity) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ejb.address.AddressEntity[id=" + id + "]";
    }

}
